<script setup>
import { ElMessage } from 'element-plus'

const f = (i) =>{
  switch (i){
    case 1:
      ElMessage.success('这是一条成功消息');
      break;
    case 2:
      ElMessage.warning('这是一条警告消息');
      break;
    case 3:
      ElMessage.error('这是一条错误消息');
      break;
    case 4:
      ElMessage('这是一条消息');
      break;
    case 5:
      ElMessage.warning({
        showClose:true,
        message:'这是一条可关闭消息',
      });
  }
}
</script>

<template>
<h1>消息提示组件</h1>
  <el-button @click="f(1)">成功消息</el-button>
  <el-button @click="f(2)">警告消息</el-button>
  <el-button @click="f(3)">错误消息</el-button>
  <el-button @click="f(4)">普通消息</el-button>
  <el-button @click="f(5)">可关闭消息</el-button>
</template>

<style scoped>

</style>